<%@ page import="${basepackage}.${projectName}.web.admin.constant.Uri" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/WEB-INF/view/common/_common_prefix.jsp" %>
<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_PAGE_SHOW%>"
          method="get">
        <div class="bjui-searchBar">

            <button type="button" class="showMoreSearch" data-toggle="moresearch" data-name="custom">
                <i class="fa fa-angle-double-down"></i>
            </button>
            <button type="submit" class="btn-blue" data-icon="search" id="query_base_show">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true"
               data-icon="undo">清空查询</a>

            <div class="bjui-moreSearch">
                <#list table.columns as column>
                    <#if (!column.pk)>
                        ${column.columnAlias}：
                        <#if column.javaType?index_of("Date")!=-1>
                            <input type="text" id="${table.sqlNameLowerCase}_${column.columnNameFirstLower}_show_start"
                                   name="${column.columnNameFirstLower}_start"
                                   data-toggle="datepicker" placeholder="请输入开始${column.columnAlias}"
                                   data-pattern="yyyy-MM-dd HH:mm:ss" readonly="readonly"
                                   value="<hs:datefmt value="${r'${'}item.${column.columnNameFirstLower}}" type="dateTimeSecPattern"/>"/>

                            <input type="text" id="${table.sqlNameLowerCase}_${column.columnNameFirstLower}_show_end"
                                   name="${column.columnNameFirstLower}_end"
                                   data-toggle="datepicker" placeholder="请输入结束${column.columnAlias}"
                                   data-pattern="yyyy-MM-dd HH:mm:ss" readonly="readonly" data-rule="compareDate"
                                   data-compare-to="#${table.sqlNameLowerCase}_${column.columnNameFirstLower}_show_start"
                                   value="<hs:datefmt value="${r'${'}item.${column.columnNameFirstLower}}" type="dateTimeSecPattern"/>"/>

                            <#elseif column.columnNameFirstLower == 'sort'>
                                <input type="text" name="${column.columnNameFirstLower}" maxlength="6"
                                       placeholder="请输入排序号，1~999999 的整数"/>
                                <#else>
                                    <input type="text" name="${column.columnNameFirstLower}" maxlength="20"
                                           value="${'${'}entity.${column.columnNameFirstLower}}"
                                           placeholder="请输入${column.columnAlias}"/>
                        </#if>
                    </#if>
                </#list>
            </div>

            <div class="pull-right">
                <div class="btn-group">
                    <button type="button" class="btn-default dropdown-toggle" data-toggle="dropdown" data-icon="copy">
                        更多操作<span class="caret"></span></button>
                    <ul class="dropdown-menu right" role="menu">
                        <li>
                            <a href="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_ADD_SHOW%>" data-toggle="dialog"
                               data-id="${table.sqlNameLowerCase}_add" data-width="1000" data-height="600" data-mask="true"
                               data-title="新增">新增</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top data_table table_center"
           data-selected-multi="true">
        <thead>
        <tr class="line_top">
            <th>No.</th>
        <#list table.columns as column>
             <#if column.columnNameFirstLower != 'id'>
             <th>${column.columnAlias}</th>
             </#if>
        </#list>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        ${r'<c:forEach items="${list}" var="item" varStatus="varStatus">'}
        <tr>
            <td>${r'${varStatus.count}'}</td>
            <#list table.columns as column>
                <#if column.javaType?index_of("Date")!=-1 && column.columnNameFirstLower != 'id'>
            <td><hs:datefmt value="${r'${'}item.${column.columnNameFirstLower}}"
                             type="dateTimeSecPattern"/></td>
                 <#else>
            <td><hs:out value="${r'${'}item.${column.columnNameFirstLower}}"/></td>
                </#if>
            </#list>
            <td class="option">
                <a href="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_DETAIL_SHOW%>?id=${r'${'}item.${table.idColumn.columnNameFirstLower}}"
                   class="btn btn-green" data-toggle="dialog" data-id="${table.sqlNameLowerCase}_detail"
                   data-width="1000" data-height="600" data-mask="true" data-confirm-msg="查看">查看</a>
                <a href="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_UPDATE_SHOW%>?id=${r'${'}item.${table.idColumn.columnNameFirstLower}}"
                   class="btn btn-green" data-toggle="dialog" data-id="${table.sqlNameLowerCase}_update" data-mask="true"
                   data-width="1000" data-height="600" data-title="编辑">编辑</a>
                <a href="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_DEL_SUBMIT%>?id=${r'${'}item.${table.idColumn.columnNameFirstLower}}"
                   class="btn btn-green" data-toggle="doajax" data-mask="true" data-confirm-msg="确定要删除吗？">软删除</a>
                <a href="${r'${root}'}<%=Uri.${table.sqlNameUpperCase}_DELETE_SUBMIT%>?id=${r'$'}{item.${table.idColumn.columnNameFirstLower}}"
                   class="btn btn-green" data-toggle="doajax" data-mask="true" data-confirm-msg="确定要删除吗？">删除</a>
            </td>
        </tr>
        ${'</c:forEach>'}
        </tbody>
    </table>
</div>
<%@ include file="/WEB-INF/view/common/_page_footer.jsp" %>